﻿using HalconDotNet;

namespace HVision
{
    public abstract class HShape
    {
        public bool Resizable { get; set; }
        public bool Dragable { get; set; }
        public bool Selected { get; set; }
        public bool Rotatable { get; set; }
        public bool Visible { get; set; }
        public string Name { get; set; }
        public bool Selectable { get; set; }
        public bool Labeled { get; set; }
        public virtual bool Active { get; set; }
        public virtual float ZoomX { get; }
        public virtual float ZoomY { get; }
        public virtual float PanX { get; }
        public virtual float PanY { get; }

        /// <summary>
        /// 手柄个数
        /// </summary>
        internal int numHandles;

        /// <summary>
        /// 激活手柄
        /// </summary>
        internal int activeHandleIdx;

        /// <summary>
        /// 手柄尺寸
        /// </summary>
        internal int unitSize = 3;

        /// <summary>
        /// 形状类型
        /// </summary>
        public HShapeType ShapeType { get; internal set; }

        public HDragHandle HitHandle { get; internal set; }

        public abstract void Draw(HWindow hWindow);

        public abstract void MoveByHandle(double x, double y);

        public abstract double DistToClosestHandle(double x, double y);

        public abstract HRegion GetRegion();

    }

    public enum HShapeType
    {
        LineGuage,
        CircleGuage
    }

    public enum HTransitionType
    {
        Bw = 0,
        Wb = 1,
        All = 2
    }

    public enum HMetrologySelection
    {
        all,
        first,
        last
    }

    public enum HMetrologyInterpolation
    {
        nearest_neighbor,
        bicubic,
        bilinear
    }

    public enum HDragHandle
    {
        NoHandle = 0,
        Inside = 1,
        North = 2,
        East = 3,
        South = 4,
        West = 5,
        NorthWest = 6,
        SouthWest = 7,
        NorthEast = 8,
        SouthEast = 9,
        Center = 10,
        reserved0 = 11,
        reserved1 = 12,
        Org = 13,
        reserved5 = 13,
        Mid = 14,
        reserved6 = 14,
        End = 15,
        reserved7 = 15,
        reserved2 = 16,
        reserved3 = 17,
        reserved4 = 18,
        Tol0 = 19,
        Tol1 = 20,
        Tol_x0 = 21,
        Tol_a0 = 21,
        Tol_x1 = 22,
        Tol_a1 = 22,
        Tol_y0 = 23,
        Tol_AA0 = 23,
        Tol_y1 = 24,
        Tol_AA1 = 24,
        Tol_XX0 = 25,
        Tol_r0 = 25,
        Tol_XX1 = 26,
        Tol_r1 = 26,
        Tol_YY0 = 27,
        Tol_RR0 = 27,
        Tol_YY1 = 28,
        Tol_RR1 = 28,
        Edge_x = 256,
        Edge_a = 256,
        Edge_XX = 512,
        Edge_AA = 512,
        Edge_y = 1024,
        Edge_r = 1024,
        Edge_YY = 2048,
        Edge_RR = 2048,
        reserved8 = 4096,
        reserved9 = 8192,
        reserved10 = 16384,
        reserved11 = 32768
    }

}
